const express = require('express');
const bodyParser = require('body-parser');
const app = express();


/* const middleware1 = (req, res, next) => {
  console.log('1');
  next();
  console.log('1-1');
}
const middleware2 = (req, res, next) => {
  console.log('2');
  next();
  console.log('2-2');
}
const middleware3 = (req, res, next) => {
  console.log('3');
  next();
  console.log('3-3');
}

app.use(middleware1)
app.use(middleware2)
app.use(middleware3) */
// 解析 urlencoded格式
app.use(bodyParser.urlencoded({extended: false}))
// 解析 json格式
app.use(bodyParser.json())
// 路由
app.get('/home', (req, res) => {
  res.send('这是home页')
})

app.listen(3000, () => {
  console.log('start at port 3000');
})